import { devUrl } from '@/common/setting'

/**
 * @param "username"   用户名
   @param "password"   密码
   @param "member"     用户身份
 */
const login = (params) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${devUrl}/medicinalPSS/login`,
      method: 'POST',
      data: params,
      success: (res) => {
        resolve(res.data);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
};

/**
 * @param "username"   用户名
   @param "password"   密码
 */
const regist = (params) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${devUrl}/medicinalPSS/regist`,
      method: 'POST',
      data: params,
      success: (res) => {
        resolve(res.data);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
};

export { login, regist };
